<template>
  <div class="app-container">
    <div class="default-box">
      <div class="filter-container">
        <el-button class="filter-item" type="primary" icon="el-icon-refresh-right" round>
          恢复数据
        </el-button>
        <el-button class="filter-item" type="danger" icon="el-icon-close" round>
          彻底删除
        </el-button>
      </div>
      <el-table
        :key="tableKey"
        v-loading="listLoading"
        :data="list"
        fit
        highlight-current-row
        style="width: 100%;"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column label="角色名称">
          <template>
            <span>123456</span>
          </template>
        </el-table-column>
        <el-table-column label="描述">
          <template>
            <span>123456</span>
          </template>
        </el-table-column>
        <el-table-column label="创建时间">
          <template>
            <span>
              2023-03-15 17:25:28
            </span>
          </template>
        </el-table-column>
        <el-table-column label="更新时间">
          <template>
            <span>
              2023-03-15 17:25:28
            </span>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
    </div>
  </div>
</template>

<script>
import { fetchList } from '@/api/article'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
export default {
  name: 'Recycle',
  components: { Pagination },
  data() {
    return {
      tableKey: 0,
      list: null,
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 10,
        account: ''
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      fetchList(this.listQuery).then(response => {
        this.list = response.data.items
        this.total = response.data.total
        setTimeout(() => {
          this.listLoading = false
        }, 1.5 * 1000)
      })
    },
    // 重置
    handlReset() {
      this.listQuery.account = ''
    }
  }
}
</script>
<style scoped>
  [class^=el-icon-], [class*=" el-icon-"]{
    font-size: 16px;
  }
  .small-padding i{
    margin-right: 12px;
  }
  .small-padding i:last-child{
    margin-right: 0px;
  }
</style>
